﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.Flexibles.CApCableRetractSystemAttachmentType2Control
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.Flexibles;

public class CApCableRetractSystemAttachmentType2Control : 
  UserControl,
  ICUiFLEXAttachmentEditControl,
  IComponentConnector
{
  internal Border RetractSystemAttachmentType2Border;
  internal Canvas CanvasRetractSystemAttachmentType2;
  internal Rectangle AttachmentGraphicObjectRetractSystemType2;
  internal Canvas StartFrameAxesRetractSystemType2;
  internal TextBlock StartFrameLabelRetractSystemType2;
  internal Canvas StartFramePointerRetractSystemType2;
  internal Canvas EndFrameAxesRetractSystemType2;
  internal Canvas EndFramePointerRetractSystemType2;
  internal TextBlock EndFrameLabelRetractSystemType2;
  internal Canvas MaxRetractedLengthCanvasRetractSystemType2;
  internal TextBlock MaxRetractedLengthLabelRetractSystemType2;
  internal Rectangle BlackBoxRetractSystemType2;
  internal Viewbox SpringViewBoxRetractSystemType2;
  internal Grid grid;
  internal Rectangle MinRetractedLengthLimitRetractSystemType2;
  internal Canvas MinRetractedLengthCanvasRetractSystemType2;
  internal TextBlock MinRetractedLengthLabelRetractSystemType2;
  internal Path CableSimulatedSectionRetractSystemType2;
  internal Canvas AttachmentFrameAxesRetractSystemType2;
  internal TextBlock AttachmentFrameLabelRetractSystemType2;
  internal Canvas AttachmentFramePointerRetractSystemType2;
  internal TextBlock DistanceFromStartLabelRetractSystemType2;
  internal Path DistanceFromStartFocusRetractSystemType2;
  internal Path DistanceFromStartPathRetractSystemType2;
  internal Rectangle MaxRetractedLengthLimitRetractSystemType2;
  internal Canvas DistanceFromStartPointerRetractSystemType2;
  internal Canvas DistanceFromStartHitBoxRetractSystemType2;
  internal Canvas AttachmentFrameHitBoxRetractSystemType2;
  internal Rectangle MaxRetractedLengthHitBoxRetractSystemType2;
  internal Rectangle MinRetractedLengthHitBoxRetractSystemType2;
  internal Rectangle SpringConstantHitBoxRetractSystemType2;
  internal StackPanel RetractSystemAttachmentType2Panel;
  internal Grid RetractSystemAttachmentType2Grid;
  internal TextBlock RetractSystemType2AttachmentFrameLabel;
  internal TxObjEditBoxControl RetractSystemType2AttachmentFrameBoxCtrl;
  internal TextBlock RetractSystemType2DistanceFromStartLabel;
  internal TxNumericEditBoxControl RetractSystemType2DistanceFromStartTxNumericEditBox;
  internal TextBlock RetractSystemType2SpringConstantLabel;
  internal TxNumericEditBoxControl RetractSystemType2SpringConstantTxNumericEditBox;
  internal TextBlock RetractSystemType2MinRetractedLengthLabel;
  internal TxNumericEditBoxControl RetractSystemType2MinRetractedLengthTxNumericEditBox;
  internal TextBlock RetractSystemType2MaxRetractedLengthLabel;
  internal TxNumericEditBoxControl RetractSystemType2MaxRetractedLengthTxNumericEditBox;
  private bool _contentLoaded;

  public event ParameterChangeEventHandler ParameterChanged;

  public new string Name { get; set; }

  public CApFlexParameterController ParameterController { get; set; }

  public TxObjEditBoxControl FrameEditBoxCtrlAttachment
  {
    get => this.RetractSystemType2AttachmentFrameBoxCtrl;
  }

  public ICApFLEXCableAttributeViewModel AttributeViewModel { get; private set; }

  public CApFLEXCableAttachmentViewModel AttachmentViewModel { get; private set; }

  public CApFLEXAttachmentEditorViewModel EditorViewModel { get; }

  public List<Storyboard> AttachmentStoryboards
  {
    get
    {
      return new List<Storyboard>(1)
      {
        this.CanvasRetractSystemAttachmentType2.FindResource((object) "PreviewRetractSystemAttachmentType2") as Storyboard
      };
    }
  }

  public Storyboard ActiveAttachmentStoryboard
  {
    get
    {
      return this.CanvasRetractSystemAttachmentType2.FindResource((object) "PreviewRetractSystemAttachmentType2") as Storyboard;
    }
  }

  public Shape SimulatedShape => (Shape) this.CableSimulatedSectionRetractSystemType2;

  public CApCableAttachmentFrameController AttachmentFrameController { get; set; }

  private bool IsControlLoading => this.EditorViewModel.IsControlLoading;

  private bool IsControlActivated => this.EditorViewModel.IsControlActivated;

  private TxNumericEditBoxControl LastFocusedNumericBox { get; set; }

  public CApCableRetractSystemAttachmentType2Control()
  {
    this.EditorViewModel = new CApFLEXAttachmentEditorViewModel();
  }

  public void InitControl(
    ICApFLEXCableAttributeViewModel attributeViewModel,
    CApFLEXCableAttachmentViewModel attachmentViewModel,
    CApFLEXFrameValidator frameValidator,
    bool isCreationMode,
    CApFlexParameterController parameterController,
    CApCableAttachmentStatusAnalysis cableAttachmentStatusAnalysis,
    CApCableAttachmentFrameController attachmentFrameController)
  {
    this.AttributeViewModel = attributeViewModel;
    this.AttachmentViewModel = attachmentViewModel;
    this.ParameterController = parameterController;
    this.AttachmentFrameController = attachmentFrameController;
    this.InitializeComponent();
    this.RegisterNumericalControlEvents();
    this.InitRetractSystemType2FrameEditBox(frameValidator, isCreationMode);
    this.UpdateLabelText();
    this.SetBindings();
  }

  private void InitRetractSystemType2FrameEditBox(
    CApFLEXFrameValidator frameValidator,
    bool isCreationMode)
  {
    ((UIElement) this.RetractSystemType2AttachmentFrameBoxCtrl).Focusable = this.AttachmentViewModel.IsEditableAttachment;
    this.RetractSystemType2AttachmentFrameBoxCtrl.ValidatorType = (TxValidatorType) 6;
    this.RetractSystemType2AttachmentFrameBoxCtrl.SetValidator((ITxValidator) frameValidator);
    this.RetractSystemType2AttachmentFrameBoxCtrl.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.RetractSystemType2RetractionSystemkFrameEditBoxCtrl_Picked);
    if (!isCreationMode)
      this.RetractSystemType2AttachmentFrameBoxCtrl.Object = (ITxObject) this.AttachmentViewModel.FixedFrame;
    ((UIElement) this.RetractSystemType2AttachmentFrameBoxCtrl).KeyUp += new KeyEventHandler(this.RetractSystemAttachmentType2Frame_KeyUp);
  }

  public void SetUpStoryboardsParameters()
  {
    this.ActiveAttachmentStoryboard.SpeedRatio = 1.5;
    this.ActiveAttachmentStoryboard.AutoReverse = true;
  }

  public void UpdateLabelText()
  {
    this.UpdateLinearUnitText();
    this.UpdateConstantSpringLabel();
  }

  public void UpdateLinearUnitText()
  {
    string str1 = CApFLEXStringTable.AttachmentLengthLabel + CApCableUtility.LinearUnitLabelText();
    string str2 = CApFLEXStringTable.AttachmentMaxRetractedLengthLabel + CApCableUtility.LinearUnitLabelText();
    this.RetractSystemType2DistanceFromStartLabel.Text = str1;
    this.RetractSystemType2MaxRetractedLengthLabel.Text = str2;
    this.RetractSystemType2MinRetractedLengthLabel.Text = CApFLEXStringTable.AttachmentMinRetractedLengthLabel + CApCableUtility.LinearUnitLabelText();
  }

  public void UpdateConstantSpringLabel()
  {
    TextBlock springConstantLabel = this.RetractSystemType2SpringConstantLabel;
    springConstantLabel.Text = $"{springConstantLabel.Text} ({CApFLEXStringTable.SpringConstantUnitString}):";
    this.RetractSystemType2SpringConstantTxNumericEditBox.DecimalPlaces = 2;
  }

  public void UpdateAttachmentCtrlBox()
  {
    this.RetractSystemType2AttachmentFrameBoxCtrl.Text = "";
    this.RetractSystemType2AttachmentFrameBoxCtrl.Object = (ITxObject) this.AttachmentViewModel.FixedFrame;
    if (this.AttachmentViewModel.FixedFrame != null)
      return;
    this.RetractSystemType2AttachmentFrameBoxCtrl.Focus();
  }

  private void RegisterNumericalControlEvents()
  {
    this.RetractSystemType2DistanceFromStartTxNumericEditBox.TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.RetractSystemType2DistanceFromStartTxNumericEditBox_TentativeValueChanged);
    this.RetractSystemType2MinRetractedLengthTxNumericEditBox.TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxAttachmentMinRetractedLength_TentativeValueChanged);
    this.RetractSystemType2MaxRetractedLengthTxNumericEditBox.TentativeValueChanged += new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxAttachmentMaxRetractedLength_TentativeValueChanged);
  }

  private void UnregisterNumericalControlEvents()
  {
    this.RetractSystemType2DistanceFromStartTxNumericEditBox.TentativeValueChanged -= new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.RetractSystemType2DistanceFromStartTxNumericEditBox_TentativeValueChanged);
    this.RetractSystemType2MinRetractedLengthTxNumericEditBox.TentativeValueChanged -= new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxAttachmentMinRetractedLength_TentativeValueChanged);
    this.RetractSystemType2MaxRetractedLengthTxNumericEditBox.TentativeValueChanged -= new TxNumericEditBoxCtrl_TentativeValueChangedEventHandler(this.TxNumericEditBoxAttachmentMaxRetractedLength_TentativeValueChanged);
  }

  private void SetBindings()
  {
    Binding binding = new Binding()
    {
      Source = (object) this,
      Path = new PropertyPath("EditorViewModel.IsPreviewIdle", Array.Empty<object>()),
      Converter = (IValueConverter) new BooleanToDiagramVisibilityConverter()
    };
    this.StartFramePointerRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.StartFrameAxesRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.StartFrameLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.EndFramePointerRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.EndFrameAxesRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.EndFrameLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentFramePointerRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentFrameAxesRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentFrameLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.AttachmentFrameHitBoxRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.DistanceFromStartPathRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.DistanceFromStartPointerRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.DistanceFromStartLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.DistanceFromStartFocusRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.DistanceFromStartHitBoxRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MinRetractedLengthCanvasRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MinRetractedLengthLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MinRetractedLengthHitBoxRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MaxRetractedLengthCanvasRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MaxRetractedLengthLabelRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.MaxRetractedLengthHitBoxRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
    this.SpringConstantHitBoxRetractSystemType2.SetBinding(UIElement.VisibilityProperty, (BindingBase) binding);
  }

  private void AttachmentFrame_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    this.RetractSystemType2AttachmentFrameBoxCtrl.Focus();
  }

  private void AttachmentFrame_GotFocus(object sender, RoutedEventArgs e)
  {
    this.DoSetDefaultFocus();
  }

  private void AttachmentFrame_LostFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.AttachmentFrameSelected = false;
  }

  private void DistanceFromStart_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    ((UIElement) this.RetractSystemType2DistanceFromStartTxNumericEditBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
  }

  private void DistanceFromStart_GotFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.DistanceFromStartSelected = true;
  }

  private void DistanceFromStart_LostFocus(object sender, RoutedEventArgs e)
  {
    this.AttachmentViewModel.DistanceFromStartSelected = false;
  }

  private void SpringConstant_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    ((UIElement) this.RetractSystemType2SpringConstantTxNumericEditBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
  }

  private void SpringConstant_GotFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.SpringConstantSelected = true;
  }

  private void SpringConstant_LostFocus(object sender, RoutedEventArgs e)
  {
    this.AttachmentViewModel.SpringConstantSelected = false;
  }

  private void MinRetractedLength_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    ((UIElement) this.RetractSystemType2MinRetractedLengthTxNumericEditBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
  }

  private void MinRetractedLength_GotFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.MinRetractedLengthSelected = true;
  }

  private void MinRetractedLength_LostFocus(object sender, RoutedEventArgs e)
  {
    this.AttachmentViewModel.MinRetractedLengthSelected = false;
  }

  private void MaxRetractedLength_DiagramFocus(object sender, MouseButtonEventArgs e)
  {
    ((UIElement) this.RetractSystemType2MaxRetractedLengthTxNumericEditBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
  }

  private void MaxRetractedLength_GotFocus(object sender, RoutedEventArgs e)
  {
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.MaxRetractedLengthSelected = true;
  }

  private void MaxRetractedLength_LostFocus(object sender, RoutedEventArgs e)
  {
    this.AttachmentViewModel.MaxRetractedLengthSelected = false;
  }

  public void UpdateAttachmentParametersWithParameters()
  {
    if (!this.IsControlActivated)
      return;
    this.AttachmentViewModel.Location = CApFLEXAttachmentLocation.AlongCable;
    this.AttachmentViewModel.FixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.SecondaryFixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.LengthFromStart = this.AttributeViewModel.Length * 0.5;
    this.AttachmentViewModel.SpringConstant = this.ParameterController.RetractSystemSpringConstant;
    this.AttachmentViewModel.MinRetractedLength = this.ParameterController.RetractSystemMinRetractLength;
    this.AttachmentViewModel.MaxRetractedLength = this.ParameterController.RetractSystemMaxRetractLength;
  }

  public void UpdateAttachmentParametersWithAttachment(CApFLEXAttachment attachment)
  {
    if (!this.IsControlActivated)
      return;
    this.AttachmentViewModel.AttachmentType = attachment.AttachmentType;
    this.AttachmentViewModel.Location = attachment.Location;
    this.AttachmentViewModel.FixedFrame = attachment.FixedFrame;
    this.AttachmentViewModel.SecondaryFixedFrame = (ITxLocatableObject) null;
    this.AttachmentViewModel.LengthFromStart = attachment.LengthFromStart;
    CApFLEXRetractSystemAttachmentType2 systemAttachmentType2 = attachment as CApFLEXRetractSystemAttachmentType2;
    this.AttachmentViewModel.SpringConstant = systemAttachmentType2.SpringConstant;
    this.AttachmentViewModel.MinRetractedLength = systemAttachmentType2.MinRetractedLength;
    this.AttachmentViewModel.MaxRetractedLength = systemAttachmentType2.MaxRetractedLength;
  }

  public void SetDefaultFocus()
  {
    if (!this.IsControlActivated)
      return;
    this.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Delegate) (() => this.RetractSystemType2AttachmentFrameBoxCtrl.Focus()));
    this.DoSetDefaultFocus();
  }

  private void DoSetDefaultFocus()
  {
    if (this.RetractSystemType2AttachmentFrameBoxCtrl.Text != "")
      CApCableUtility.HighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.AttachmentFrameSelected = true;
  }

  public void SetEnabledAllParametersControls(bool isEnabled)
  {
    if (!isEnabled)
      this.LastFocusedNumericBox = this.GetCurrentlyFocusedNumericBox();
    this.RetractSystemAttachmentType2Panel.IsEnabled = isEnabled;
    if (!isEnabled || this.LastFocusedNumericBox == null)
      return;
    ((UIElement) this.LastFocusedNumericBox).MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
    this.LastFocusedNumericBox = (TxNumericEditBoxControl) null;
  }

  private TxNumericEditBoxControl GetCurrentlyFocusedNumericBox()
  {
    TxNumericEditBoxControl focusedNumericBox = (TxNumericEditBoxControl) null;
    if (this.AttachmentViewModel.DistanceFromStartSelected)
      focusedNumericBox = this.RetractSystemType2DistanceFromStartTxNumericEditBox;
    else if (this.AttachmentViewModel.SpringConstantSelected)
      focusedNumericBox = this.RetractSystemType2SpringConstantTxNumericEditBox;
    else if (this.AttachmentViewModel.MinRetractedLengthSelected)
      focusedNumericBox = this.RetractSystemType2MinRetractedLengthTxNumericEditBox;
    else if (this.AttachmentViewModel.MaxRetractedLengthSelected)
      focusedNumericBox = this.RetractSystemType2MaxRetractedLengthTxNumericEditBox;
    return focusedNumericBox;
  }

  public void DidDialogClose()
  {
    this.UnregisterNumericalControlEvents();
    this.RetractSystemType2AttachmentFrameBoxCtrl.Picked -= new TxObjEditBoxCtrl_PickedEventHandler(this.RetractSystemType2RetractionSystemkFrameEditBoxCtrl_Picked);
    ((UIElement) this.RetractSystemType2AttachmentFrameBoxCtrl).KeyUp -= new KeyEventHandler(this.RetractSystemAttachmentType2Frame_KeyUp);
  }

  private void RetractSystemType2RetractionSystemkFrameEditBoxCtrl_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    TxFrame selectedFrame = this.RetractSystemType2AttachmentFrameBoxCtrl.Object as TxFrame;
    ITxLocatableObject fixedFrame = this.AttachmentViewModel.FixedFrame;
    this.AttachmentFrameController.FrameEditorPicked(selectedFrame, ref fixedFrame, this.RetractSystemType2AttachmentFrameBoxCtrl.Text);
    this.AttachmentViewModel.FixedFrame = fixedFrame;
  }

  private void RetractSystemType2DistanceFromStartTxNumericEditBox_TentativeValueChanged(
    object sender,
    TxNumericEditBoxCtrl_TentativeValueChangedEventArgs args)
  {
    if (this.IsControlLoading || !this.IsControlActivated)
      return;
    this.AttachmentViewModel.SetLengthFromStartNoEventSent(args.TentativeValue * TxApplication.Options.Units.LinearMultiplier);
    this.ParameterChanged();
  }

  private void TxNumericEditBoxAttachmentMinRetractedLength_TentativeValueChanged(
    object sender,
    TxNumericEditBoxCtrl_TentativeValueChangedEventArgs args)
  {
    if (this.IsControlLoading || !this.IsControlActivated)
      return;
    this.AttachmentViewModel.SetMinRetractedLengthNoEventSent(args.TentativeValue * TxApplication.Options.Units.LinearMultiplier);
    this.ParameterChanged();
  }

  private void TxNumericEditBoxAttachmentMaxRetractedLength_TentativeValueChanged(
    object sender,
    TxNumericEditBoxCtrl_TentativeValueChangedEventArgs args)
  {
    if (this.IsControlLoading || !this.IsControlActivated)
      return;
    this.AttachmentViewModel.SetMaxRetractedLengthNoEventSent(args.TentativeValue * TxApplication.Options.Units.LinearMultiplier);
    this.ParameterChanged();
  }

  private void RetractSystemAttachmentType2Frame_KeyUp(object sender, KeyEventArgs e)
  {
    if (e.Key != Key.Back && e.Key != Key.Delete)
      return;
    this.AttachmentFrameController.AttachmentParentFrameDidChanged(this.AttachmentViewModel.FixedFrame);
    CApCableUtility.UnHighlightObject((ITxDisplayableObject) (this.AttachmentViewModel.FixedFrame as TxFrame));
    this.AttachmentViewModel.FixedFrame = (ITxLocatableObject) null;
    this.RetractSystemType2AttachmentFrameBoxCtrl.Text = "";
    this.ParameterChanged();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/flexibles/attachmentcontrols/capcableretractsystemattachmenttype2control.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        this.RetractSystemAttachmentType2Border = (Border) target;
        break;
      case 2:
        this.CanvasRetractSystemAttachmentType2 = (Canvas) target;
        break;
      case 3:
        this.AttachmentGraphicObjectRetractSystemType2 = (Rectangle) target;
        break;
      case 4:
        this.StartFrameAxesRetractSystemType2 = (Canvas) target;
        break;
      case 5:
        this.StartFrameLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 6:
        this.StartFramePointerRetractSystemType2 = (Canvas) target;
        break;
      case 7:
        this.EndFrameAxesRetractSystemType2 = (Canvas) target;
        break;
      case 8:
        this.EndFramePointerRetractSystemType2 = (Canvas) target;
        break;
      case 9:
        this.EndFrameLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 10:
        this.MaxRetractedLengthCanvasRetractSystemType2 = (Canvas) target;
        break;
      case 11:
        this.MaxRetractedLengthLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 12:
        this.BlackBoxRetractSystemType2 = (Rectangle) target;
        break;
      case 13:
        this.SpringViewBoxRetractSystemType2 = (Viewbox) target;
        break;
      case 14:
        this.grid = (Grid) target;
        break;
      case 15:
        this.MinRetractedLengthLimitRetractSystemType2 = (Rectangle) target;
        break;
      case 16 /*0x10*/:
        this.MinRetractedLengthCanvasRetractSystemType2 = (Canvas) target;
        break;
      case 17:
        this.MinRetractedLengthLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 18:
        this.CableSimulatedSectionRetractSystemType2 = (Path) target;
        break;
      case 19:
        this.AttachmentFrameAxesRetractSystemType2 = (Canvas) target;
        break;
      case 20:
        this.AttachmentFrameLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 21:
        this.AttachmentFramePointerRetractSystemType2 = (Canvas) target;
        break;
      case 22:
        this.DistanceFromStartLabelRetractSystemType2 = (TextBlock) target;
        break;
      case 23:
        this.DistanceFromStartFocusRetractSystemType2 = (Path) target;
        break;
      case 24:
        this.DistanceFromStartPathRetractSystemType2 = (Path) target;
        break;
      case 25:
        this.MaxRetractedLengthLimitRetractSystemType2 = (Rectangle) target;
        break;
      case 26:
        this.DistanceFromStartPointerRetractSystemType2 = (Canvas) target;
        break;
      case 27:
        this.DistanceFromStartHitBoxRetractSystemType2 = (Canvas) target;
        this.DistanceFromStartHitBoxRetractSystemType2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.DistanceFromStart_DiagramFocus);
        break;
      case 28:
        this.AttachmentFrameHitBoxRetractSystemType2 = (Canvas) target;
        this.AttachmentFrameHitBoxRetractSystemType2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.AttachmentFrame_DiagramFocus);
        break;
      case 29:
        this.MaxRetractedLengthHitBoxRetractSystemType2 = (Rectangle) target;
        this.MaxRetractedLengthHitBoxRetractSystemType2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.MaxRetractedLength_DiagramFocus);
        break;
      case 30:
        this.MinRetractedLengthHitBoxRetractSystemType2 = (Rectangle) target;
        this.MinRetractedLengthHitBoxRetractSystemType2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.MinRetractedLength_DiagramFocus);
        break;
      case 31 /*0x1F*/:
        this.SpringConstantHitBoxRetractSystemType2 = (Rectangle) target;
        this.SpringConstantHitBoxRetractSystemType2.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.SpringConstant_DiagramFocus);
        break;
      case 32 /*0x20*/:
        this.RetractSystemAttachmentType2Panel = (StackPanel) target;
        break;
      case 33:
        this.RetractSystemAttachmentType2Grid = (Grid) target;
        break;
      case 34:
        this.RetractSystemType2AttachmentFrameLabel = (TextBlock) target;
        break;
      case 35:
        this.RetractSystemType2AttachmentFrameBoxCtrl = (TxObjEditBoxControl) target;
        ((UIElement) this.RetractSystemType2AttachmentFrameBoxCtrl).GotFocus += new RoutedEventHandler(this.AttachmentFrame_GotFocus);
        ((UIElement) this.RetractSystemType2AttachmentFrameBoxCtrl).LostFocus += new RoutedEventHandler(this.AttachmentFrame_LostFocus);
        break;
      case 36:
        this.RetractSystemType2DistanceFromStartLabel = (TextBlock) target;
        break;
      case 37:
        this.RetractSystemType2DistanceFromStartTxNumericEditBox = (TxNumericEditBoxControl) target;
        ((UIElement) this.RetractSystemType2DistanceFromStartTxNumericEditBox).GotFocus += new RoutedEventHandler(this.DistanceFromStart_GotFocus);
        ((UIElement) this.RetractSystemType2DistanceFromStartTxNumericEditBox).LostFocus += new RoutedEventHandler(this.DistanceFromStart_LostFocus);
        break;
      case 38:
        this.RetractSystemType2SpringConstantLabel = (TextBlock) target;
        break;
      case 39:
        this.RetractSystemType2SpringConstantTxNumericEditBox = (TxNumericEditBoxControl) target;
        ((UIElement) this.RetractSystemType2SpringConstantTxNumericEditBox).GotFocus += new RoutedEventHandler(this.SpringConstant_GotFocus);
        ((UIElement) this.RetractSystemType2SpringConstantTxNumericEditBox).LostFocus += new RoutedEventHandler(this.SpringConstant_LostFocus);
        break;
      case 40:
        this.RetractSystemType2MinRetractedLengthLabel = (TextBlock) target;
        break;
      case 41:
        this.RetractSystemType2MinRetractedLengthTxNumericEditBox = (TxNumericEditBoxControl) target;
        ((UIElement) this.RetractSystemType2MinRetractedLengthTxNumericEditBox).GotFocus += new RoutedEventHandler(this.MinRetractedLength_GotFocus);
        ((UIElement) this.RetractSystemType2MinRetractedLengthTxNumericEditBox).LostFocus += new RoutedEventHandler(this.MinRetractedLength_LostFocus);
        break;
      case 42:
        this.RetractSystemType2MaxRetractedLengthLabel = (TextBlock) target;
        break;
      case 43:
        this.RetractSystemType2MaxRetractedLengthTxNumericEditBox = (TxNumericEditBoxControl) target;
        ((UIElement) this.RetractSystemType2MaxRetractedLengthTxNumericEditBox).GotFocus += new RoutedEventHandler(this.MaxRetractedLength_GotFocus);
        ((UIElement) this.RetractSystemType2MaxRetractedLengthTxNumericEditBox).LostFocus += new RoutedEventHandler(this.MaxRetractedLength_LostFocus);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
